﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DP.Web.UI;
using System.Net;
using CRM.BLL;
using CRM.Entity;

namespace CRM.Web.RecordManage
{
    public partial class RecordPlay : Common.PageBase
    {
        public string FileUrl = "";

        private T_RECORD_BLL recordBll = new T_RECORD_BLL();

        protected override void OnInit(EventArgs e)
        {
            base.VerificationRight = false;
            base.OnInit(e);
        }
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                string inum = PageHelper.GetQueryString(this.Page, "INUM");
                string virtualPath = "~/TempFilePath/RecordFile/" + inum + ".wav";

                string filePath = Request.MapPath(virtualPath);
                if(System.IO.File.Exists(filePath))
                {
                    FileUrl = virtualPath.Replace("~", "..");
                }
                else
                {
                    recordBll.DownloadFile(inum, filePath);
                    FileUrl = virtualPath.Replace("~", "..");
                }

            }
        }
    }
}
